import { IndexedDBServiceBase } from './indexeddb-service-base';

/**
 * IndexedDB数据库服务
 *
 * @export
 * @class IndexedDBService
 * @extends {IndexedDBServiceBase}
 */
export class IndexedDBService extends IndexedDBServiceBase {

    /**
     * 唯一实例
     *
     * @private
     * @static
     * @type {IndexedDBService}
     * @memberof IndexedDBService
     */
    private static readonly instance: IndexedDBService = new IndexedDBService();

    /**
     * Creates an instance of IndexedDBService.
     * @memberof IndexedDBService
     */
    protected constructor() {
        if (IndexedDBService.instance) {
            return IndexedDBService.instance;
        }
        super('2021-10-21');
    }

    /**
     * 实体配置初始化
     *
     * @protected
     * @memberof IndexedDBServiceBase
     */
    protected entityConfigInit(): void {
        this.entityConfigs.push({ name: 'order_detail', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'manager_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'shop_star', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'agricultureproducts', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'goods_evaluate', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'security_infom', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'shop_evaluate', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'task_evaluate', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'task_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'securityinfo', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'order_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'student_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'notice_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'shop_examine', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'goods_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'town_info', keyPath: 'srfsessionkey' });
        this.entityConfigs.push({ name: 'shop_info', keyPath: 'srfsessionkey' });
    }

    /**
     * 获取实例
     *
     * @returns {IndexedDBService}
     * @memberof IndexedDBService
     */
    public static getInstance(): IndexedDBService {
        return IndexedDBService.instance;
    }

}